/**
 * Created by yangfan on 2016/10/12.
 */
define(['config/appregister',"../../services/httpServices","i18n"],function(app,httpService,i18n){
    app.directive("pagesSet",function(){
        return {
            template:'<a ng-repeat="item in everPageShow track by $index " ng-bind="item" ng-class="{true:'+'addRightBorder'+',false:'+'notAddRightBorder'+'}[isAddRightBorder]"></a>',
            scope:true,
            link:function(scope,element,attrs){
                scope.isAddRightBorder = true;
                if($index =="last"){
                    scope.isAddRightBorder = false;
                }
            }
        }
    }).directive("getDynamic",function($state){
            return {
            templateUrl:'app/business/personMine/template/myMainPageDynamic.html',
            scope:{
                conf:"=confData",
                pic:"=personData"
            },
            link:function(scope,element,attrs){
                if(scope.conf.pdFormatId!=null){
                    switch (scope.conf.pdFormatId){
                        case 1:
                            scope.imgSrc="them/images/compImages/type-doc.png";
                            break;
                        case 11:
                            scope.imgSrc="them/images/compImages/type-pdf.png";
                            break;
                        case 12:
                            scope.imgSrc="them/images/compImages/type-txt.png";
                            break;
                        case 14:
                            scope.imgSrc="them/images/compImages/type-xls.png";
                            break;
                        case 15:
                            scope.imgSrc="them/images/compImages/type-ppt.png";
                            break;
                        case 16:
                            scope.imgSrc="them/images/compImages/type-rar.png";
                            break;
                        case 17:
                            scope.imgSrc="them/images/compImages/type-swf.png";
                            break;
                        case 18:
                            scope.imgSrc="them/images/compImages/type-jpeg.png";
                            break;
                        case 19:
                            scope.imgSrc="them/images/compImages/type-chm.png";
                            break;
                        case 20:
                            scope.imgSrc="them/images/compImages/type-dwg.png";
                            break;
                        case 21:
                            scope.imgSrc="them/images/compImages/type-caj.png";
                            break;
                    }
                }
                scope.jumpToHomePage=function(){
                    $state.go('homepage');
                };
				scope.goOtherDetail = function(item){
					if(item.pdType == 1 || item.pdType == 2 || item.pdType == 3){
						//跳转工程资料详情
						$state.go('eng.techdetail',{'fileId':item.fkId})
					}
					if(item.pdType == 4 || item.pdType == 5 || item.pdType == 5){
						//跳转论文图书馆详情
						$state.go('eng.libraryDetail',{'thesisId':item.fkId})
					}
					if(item.pdType == 9 || item.pdType == 10 || item.pdType == 11){
						//跳转白问百答详情
						$state.go('eng.postbardeta',{'postbarId':item.fkId})
					}
                    if(item.pdType == 7 || item.pdType == 8){
                        $state.go('eng.vedioDetails',{'courseId':item.fkId})
                    }
                    if(item.pdType == 12){
                        $state.go('blogxq',{'blogId':item.fkId})
                    }
				}
                scope.goOtherHome = function(Id){
                    $state.go('othersMainPage',{userId:Id})
                };
                scope.goDetail=function(Id){
                    $state.go('eng.postbardeta',{postbarId:Id})
                }
            }
        }
    })


});
